<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>注册页面</title>
<%@ include file="/web/header.jsp"%>
</head>
<!--http://127.0.0.1:8080/zzdemo220111/web/reg.jsp -->
<body style="background: #f1f1f1">
	<div class="window">
		<fieldset class="layui-elem-field" style="margin: 10px">
			<legend>注册</legend>
			<div class="layui-field-box">
				<form class="layui-form layui-form-pane" action="">
					<div class="layui-form-item">
						<label class="layui-form-label"><i class="layui-icon layui-icon-username "style="color: blue"></i>&nbsp&nbsp账号</label>
						<div class="layui-input-inline">
							<input type="text" name="code" required lay-verify="required"
								placeholder="请输入账号" autocomplete="off" class="layui-input">							 
						</div>						
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label"><i class="layui-icon layui-icon-key"style="color: blue"></i>&nbsp&nbsp密码</label>
						<div class="layui-input-inline">
							<input type="text" name="pass" required lay-verify="required"
								placeholder="请输入密码" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<label class="layui-form-label">姓名</label>
						<div class="layui-input-inline">
							<input type="text" name="name" required lay-verify="required"
								placeholder="请输入姓名" autocomplete="off" class="layui-input">
						</div>
					</div>
					<div class="layui-form-item">
						<div class="layui-input-inline">
							<input type="button" value="注册" class="layui-btn" lay-submit
								lay-filter="reg"> 
							<input type="reset" value="重置"class="layui-btn layui-btn-primary">
								
						</div>
						<input type="button" value="返回登录" class="layui-btn" onclick="toHref()">
					</div>
					<input type="hidden" name="action" value="reg">
				</form>
			</div>
		</fieldset>
	</div>
	<script type="text/javascript">
// 		var form = layui.form; 
// 		var $ = layui.jquery;
// 		var layer = layui.layer;
//		form.on("submit(reg)", function(data) {//layer.msg("asdasd");
			//console.log(data.field)
// 			$.ajax({
// 				 url:base.app+"/EmployeeServlet" ,
// 				 data:data.field,
// 				 type:"post",
// 				 dataType:"text",
// 				 success:function(data){
// 					 if(data==1){
// 						 layer.msg("注册成功"); 
// 					 }else if(data=="repeat"){
// 						 layer.msg("注册失败，账号重复");
// 					 }else{
// 						 layer.msg("注册失败"); 
// 					 }
					   
// 				 }
// 			});
// 		});
formSubmit("reg","/EmployeeServlet","text",function(data){
	if(data==1){
		 layer.msg("注册成功"); 
	 }else if(data=="repeat"){
		 layer.msg("注册失败，账号重复");
	 }else{
		 layer.msg("注册失败"); 
	 }
})
function toHref(){
	   location.href = base.app+"/web/login.jsp"
   }
	</script>
</body>
</html>

